from typing import Optional
from application.mapper import BaseMapper
from application.model.FollowModel import FollowModel


class FollowMapper(BaseMapper):
    """
    用户关注关联DAO层
    """
    orm_model: FollowModel = FollowModel

    @classmethod
    async def get_info_by_follow_and_fans(cls, follower_id: int, followee_id: int) -> Optional[FollowModel]:
        """
        根据关注者ID和粉丝ID获取关注信息
        :param follower_id: 关注者ID
        :param followee_id: 粉丝ID
        :return:
        """
        return await cls.orm_model.filter(follower_id=follower_id, followee_id=followee_id).first()
